home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 26.zip
/
BS1 part 26
/
C for beginners.adf
/
source
/
factorial.c
< prev
next >
Wrap
C/C++ Source or Header
|
1978-01-17
|
394b
|
121 lines
/* factorial.c 5.1 */
void main()
{
int num, i;
float factorial;
printf("Please input a number: ");
scanf("%d", &num);
i = num;
factorial = 1; /*Initialize */
while(i >= 1)
{
factorial = factorial * i;
i = i - 1;
}
printf("%d! = %f\n", num, factorial);
}